#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 1010;
int primes[N], cnt;
int phi[N], n;
bool st[N];
int t;
void get_primes(int n)
{
    phi[1] = 1;
    for (int i = 2; i <= n; i++)
    {
        if (!st[i])
        {
            primes[cnt++] = i;
            phi[i] = i - 1;
        }
        for (int j = 0; primes[j] <= n / i; j++)
        {
            st[i * primes[j]] = true;
            if (i % primes[j] == 0)
            {
                phi[i * primes[j]] = primes[j] * phi[i];
                break;
            }
            phi[i * primes[j]] = (primes[j] - 1) * phi[i];
        }
    }
}
int main()
{
    get_primes(N - 1);
    cin >> t;
    for (int i = 1; i <= t; i++)
    {
        cin >> n;
        int res = 1;
        for (int j = 1; j <= n; j++) res += 2 * phi[j];
        cout << i << " " << n << " " << res << endl;
    }
    return 0;
}
